﻿namespace apitest.Application.Test.Services
{
    public class AliyunService 
    {
        public static AlibabaCloud.SDK.Dyvmsapi20170525.Client CreateClient()
        {
            // 工程代码泄露可能会导致 AccessKey 泄露，并威胁账号下所有资源的安全性。以下代码示例仅供参考。
            // 建议使用更安全的 STS 方式，更多鉴权访问方式请参见：https://help.aliyun.com/document_detail/378671.html。
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config
            {
                //// 必填，请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                //AccessKeyId = "LTAI5tKmsJSt29azpB9h1BeG",
                //// 必填，请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                //AccessKeySecret = "1ZpVrpaLnKzZYa2MRqc7xrcEpUG24K",

                AccessKeyId = "LTAI5tJbWgZu7b45wfsFKPp9",
                AccessKeySecret = "dNfLkohMFeAtWFqSRzTvFAYLZFandJ",
            };
            // Endpoint 请参考 https://api.aliyun.com/product/Ecs
            config.Endpoint = "dyvmsapi.aliyuncs.com";
            return new AlibabaCloud.SDK.Dyvmsapi20170525.Client(config);
        }

        [HttpGet]
        public async Task<dynamic> t1()
        {
            AlibabaCloud.SDK.Dyvmsapi20170525.Client client = CreateClient();
            //AlibabaCloud.SDK.Dyvmsapi20170525.Models.SingleCallByTtsRequest singleCallByTtsRequest = new AlibabaCloud.SDK.Dyvmsapi20170525.Models.SingleCallByTtsRequest
            //{
            //    CalledNumber = "13438904933",
            //    TtsCode = "TTS_304815097",
            //    CalledShowNumber = "0571****5678",
            //};
            AlibabaCloud.SDK.Dyvmsapi20170525.Models.SingleCallByTtsRequest singleCallByTtsRequest = new AlibabaCloud.SDK.Dyvmsapi20170525.Models.SingleCallByTtsRequest
            {
                TtsCode = "TTS_304815097",
                CalledNumber = "13438904933",
            };
            AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();


            var res = client.SingleCallByTtsWithOptions(singleCallByTtsRequest, runtime);
            return res;
        }

    }
}
